<template>
  <div>
    <ul>
      <!-- 循环最好设置key，key值最好是唯一不变化的值 -->
      <li v-for="(item, index) in users" :key="item.id">
        {{ index }} -- {{ item.id }} -- {{ item.name }}
      </li>
    </ul>
    <hr />
    <!-- 循环对象 -->
    <h3 v-for="(item,key,index) in userinfo" :key="key">{{item}}</h3>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 数组，数组里面是一个对象
      users: [
        { id: 1, name: "张三" },
        { id: 2, name: "李四" },
        { id: 3, name: "王五" },
      ],
      userinfo: { id: 3, name: "王五" },
    };
  },
};
</script>

<style lang="scss">
</style>
